<template>
  <div class="color-card" :style="{ backgroundColor: bgColor }">
    <div class="card-content">
      <div class="card-num">{{ value }}</div>
      <div class="cart-text">{{ name }}</div>
    </div>
    <div class="card-icon">
      <slot name="icon"></slot>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
  name: 'ColorCard',
  props: {
    name: {
      type: String,
      required: true
    },
    value: {
      type: Number,
      required: true
    },
    bgColor: String
  },
  setup() {
    return {}
  }
})
</script>

<style lang="less" scoped>
.color-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  background-color: rgb(85, 165, 234);
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  border-radius: 4px;

  .card-num {
    font-size: 40px;
    font-weight: 700;
    line-height: 40px;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.9);
  }

  .card-icon {
    width: 56px;
    height: 56px;
    font-size: 56px;
    line-height: 56px;
    color: rgba(255, 255, 255, 0.58);
  }
}
</style>
